<!-- card-six.vue -->
<template>
  <a-spin style="width: 100%; margin-top: 10px">
    <a-card :bordered="false" style="height: 130px">
      <a-statistic title="当年发电量"
                   :value="renderData" animation :precision="2">
        <template #suffix>{{ 'GWh' }}</template>
      </a-statistic>
    </a-card>
  </a-spin>
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { getYearPower } from '../../../apis/home-pv'

// 获取数据
const getData = async () => {
  const res = await getYearPower()
  if (res.data.code == 200) {
    renderData.value = res.data.data.singleInfo.singleValue
  }
}

// 页面加载完成后执行
onMounted(async () => {
  await getData()
})

// 渲染数据
const renderData = ref<any>(0);
</script>